--------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\ba1hy3\Documents\Projekte\NA_EzA\RNote_2017\BJPS\final\Sieberer_etal_BJPS2018_10_Jul_2018.log
  log type:  text
 opened on:  10 Jul 2018, 17:32:34

. 
. ********************************************************************************
. ********************************************************************************
. * This Do-file contains code to reproduce the graphs and findings reported in
. * Sieberer, Ulrich / Saalfeld, Thomas / Ohmura, Tamaki / Bergmann, Henning /
. * Bailer, Stefanie, 2018, Roll call votes in the German Bundestag. 
. * A new data set, 1949-2013, British Journal of Political Science
. 
. * The replication datasets are available in the BJPolS Dataverse
. * doi: XXXXX
. 
. * IMPORTANT NOTE: 
. * The replication datasets only contain the variables used in the letter.
. * The full datasets described in the manuscript are available in the 
. * Harvard Dataverse, doi: XXXX
. ********************************************************************************
. ********************************************************************************
. 
. 
. // Name:        Sieberer_etal_BJPS2018.do
. // Task:        data analysis for Letter in BJPS
. // Version:     July 2018
. 
. version 15.1

. set more off

. 
. 
. 
. ********************************************************************************
. ********************************************************************************
. * 1. VOTE CHARACTERISTICS
. ********************************************************************************
. ********************************************************************************
. 
. use vote_characteristics_BJPS, clear
(German Roll Call Data 1949-2013 | Type 'notes' for more information.)

. 
. 
. * number of observations in dataset (mentioned in Figure 1)
. *************************************************************
. count
  1,971

. 
. * number of votes (only one record per RCV) (mentioned in Figure 1)
. *********************************************************************
. // identify RCVs on multiple alternatives at once 
. //    (recorded as multiple votes in the dataset) 
. 
. egen tag=tag(vote_id2)

. count if tag
  1,958

. 
. 
. * Number RCV per legislative period (Figure 2)
. ***********************************************
. graph hbar (count) vote_id2 if tag, over(elecper, relabel(1 "LP1 (1949-1953)" ///
>         2 "LP2 (1953-1957)" 3 "LP3 (1957-1961)" 4 "LP4 (1961-1965)" ///
>         5 "LP5 (1965-1969)" 6 "LP6 (1969-1972)" 7 "LP7 (1972-1976)" ///
>         8 "LP8 (1976-1980)" 9 "*LP9 (1980-1983)" 10 "LP10 (1983-1987)" ///
>         11 "LP11 (1987-1991)" 12 "LP12 (1991-1994)" 13 "LP13 (1994-1998)" ///
>         14 "LP14 (1998-2002)" 15 "*LP15 (2002-2005)" 16 "LP16 (2005-2009)" ///
>         17 "LP17 (2009-2013)")) ///
>         blab(bar, size(medsmall)) ///
>         ytitle("") ///
>         note(" " "* Legislative period ended prematurely due to early elections." ///
>         , span) scheme(s1mono)

. graph export Figure2.emf, replace
(file C:\Users\ba1hy3\Documents\Projekte\NA_EzA\RNote_2017\BJPS\final\Figure2.emf written in Enhanced Metafile forma
> t)

. 
. 
. * RCV request (Figure 3)
. ************************
. tab request_oppo if tag

 RCV requested |
  by at one or |
          more |
    opposition |
       parties |      Freq.     Percent        Cum.
---------------+-----------------------------------
            no |        402       20.53       20.53
           yes |        943       48.16       68.69
not applicable |        613       31.31      100.00
---------------+-----------------------------------
         Total |      1,958      100.00

. tab request_govoppo if tag

 RCV requested |
   by at least |
one party from |
government and |
    opposition |      Freq.     Percent        Cum.
---------------+-----------------------------------
            no |      1,304       66.60       66.60
           yes |         41        2.09       68.69
not applicable |        613       31.31      100.00
---------------+-----------------------------------
         Total |      1,958      100.00

. tab request_gov if tag

 RCV requested |
 by government |      Freq.     Percent        Cum.
---------------+-----------------------------------
            no |      1,226       62.61       62.61
           yes |        125        6.38       69.00
not applicable |        607       31.00      100.00
---------------+-----------------------------------
         Total |      1,958      100.00

. tab request_govpart if tag

 RCV requested |
by one or more |
    government |
       parties |      Freq.     Percent        Cum.
---------------+-----------------------------------
            no |        984       50.26       50.26
           yes |        361       18.44       68.69
not applicable |        613       31.31      100.00
---------------+-----------------------------------
         Total |      1,958      100.00

. 
. // create threefold variable gov -  oppo -  both
. gen request_threefold=.
(1,971 missing values generated)

.         replace request_threefold=1 if request_gov==1|request_govpart==1
(361 real changes made)

.         replace request_threefold=2 if request_oppo==1
(943 real changes made)

.         replace request_threefold=3 if request_govoppo==1 |request_noparty==1
(52 real changes made)

.         replace request_threefold=99 if request_threefold==.
(616 real changes made)

. label define request_threefold 1 "Government" 2 "Opposition" 3 "Both" ///
>         99 "Unknown"

. label values request_threefold request_threefold

. 
. // number of RCVs with information on requestor
. tab request_threefold if tag

request_thr |
     eefold |      Freq.     Percent        Cum.
------------+-----------------------------------
 Government |        361       18.44       18.44
 Opposition |        942       48.11       66.55
       Both |         48        2.45       69.00
    Unknown |        607       31.00      100.00
------------+-----------------------------------
      Total |      1,958      100.00

. 
. // generate a variable with sum of votes per category and legislative period
. egen group_requestor=group(elecper request_threefold)

. bysort group_requestor: egen sum_requestor_lp=sum(tag)

. 
. // label legislative period to include time spans
. label define elecper2 1 "1949-53" 2 "1953-57" 3 "1957-61" ///
>         4 "1961-65" 5 "1965-69" 6 "1969-72" 7 "1972-76" ///
>         8 "1976-80" 9 "1980-83" 10 "1983-87" ///
>         11 "1987-91" 12 "1991-94" 13 "1994-98" ///
>         14 "1998-02" 15 "2002-05" 16 "2005-09" ///
>         17 "2009-13"

. label values elecper elecper2

. 
. // graph
. tabplot request_threefold elecper if tag, percent(elecper) miss ///
>         showval(sum_requestor_lp, format(%9.0f) mlabsize(small)) ///
>         ytitle("") xtitle("") ///
>         xlab(, angle(90)) subtitle("") note( ///
>         "Numbers: absolute number of roll calls in category" ///
>         "Height of bars: percentage in this category (in this legislative period)" ///
>         " " ///
>         "Unit of observation: roll call (n= 1,958)" , span) scheme(s1mono)

. graph export Figure3.emf, replace
(file C:\Users\ba1hy3\Documents\Projekte\NA_EzA\RNote_2017\BJPS\final\Figure3.emf written in Enhanced Metafile forma
> t)

. 
. 
. * Policy areas of motions (Figure 4)
. ************************************
. tab policy1 if tag, sort nol

    primary |
     policy |
   field of |
     motion |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        480       24.51       24.51
         13 |        227       11.59       36.11
         16 |        225       11.49       47.60
         19 |        116        5.92       53.52
          3 |        111        5.67       59.19
         20 |        109        5.57       64.76
         12 |        103        5.26       70.02
         27 |         97        4.95       74.97
          5 |         90        4.60       79.57
         25 |         82        4.19       83.76
          2 |         80        4.09       87.84
          8 |         52        2.66       90.50
         14 |         32        1.63       92.13
          7 |         31        1.58       93.72
         15 |         30        1.53       95.25
          4 |         21        1.07       96.32
         10 |         19        0.97       97.29
         99 |         18        0.92       98.21
          6 |         17        0.87       99.08
         18 |         14        0.72       99.80
         21 |          3        0.15       99.95
         24 |          1        0.05      100.00
------------+-----------------------------------
      Total |      1,958      100.00

. 
. // aggregate small categories to other
. clonevar policy1_agg = policy1

.         recode policy1_agg (2=99) (4=99) (5=99) (6=99) (7=99) (8=99) (10=99) ///
>                 (14=99) (15=99) (18=99) (21=99) (24=99) (25=99) 
(policy1_agg: 476 changes made)

.         label define policy1_agg 1 "Economics" 3 "Health" 12 "Law & crime" ///
>                 13 "Welfare" 16 "Defense" 19 "Int. affairs" 20 "Gov. operation" ///
>                 27 "Const. amend." 99 "Other"

.         label values policy1_agg policy1_agg

. 
. // generate a variable with sum of votes per category and legislative period
. egen group_policy1_agg=group(elecper policy1_agg)

. bysort group_policy1_agg: egen sum_policy1_agg_lp=sum(tag)

. 
. // use tabplot (Nick Cox)
. tabplot policy1_agg elecper if tag, percent(elecper) miss ///
>         showval(sum_policy1_agg_lp, format(%9.0f) mlabsize(vsmall) offset(.22)) ///
>         ytitle("") xtitle("") ///
>         ysize(4.5) ylab(, labsize(small)) xlab(, angle(90) labsize(small)) subtitle("") note( ///
>         "Numbers: absolute number of roll calls in this category" ///
>         "Height of bars: percentage in this category (in this legislative period)" " " ///
>         "Unit of observation: roll call (n= 1,958)" , span) scheme(s1mono)

. graph export Figure4.emf, replace
(file C:\Users\ba1hy3\Documents\Projekte\NA_EzA\RNote_2017\BJPS\final\Figure4.emf written in Enhanced Metafile forma
> t)

.         
. * Free votes (mentioned in text)
. ********************************
. tab free_vote if tag

  free vote in |
  at least one |
   party group |      Freq.     Percent        Cum.
---------------+-----------------------------------
            no |      1,856       94.79       94.79
           yes |        102        5.21      100.00
---------------+-----------------------------------
         Total |      1,958      100.00

. 
. * sponsor of motion (mentioned in text)
. ***************************************
. tab sponsor_spd if tag

        motion |
  sponsored by |
           SPD |      Freq.     Percent        Cum.
---------------+-----------------------------------
            no |      1,215       62.05       62.05
           yes |        743       37.95      100.00
---------------+-----------------------------------
         Total |      1,958      100.00

. tab sponsor_cducsu if tag

        motion |
  sponsored by |
       CDU/CSU |      Freq.     Percent        Cum.
---------------+-----------------------------------
            no |      1,383       70.63       70.63
           yes |        575       29.37      100.00
---------------+-----------------------------------
         Total |      1,958      100.00

. tab sponsor_fdp if tag

        motion |
  sponsored by |
           FDP |      Freq.     Percent        Cum.
---------------+-----------------------------------
            no |      1,419       72.47       72.47
           yes |        539       27.53      100.00
---------------+-----------------------------------
         Total |      1,958      100.00

. tab sponsor_greens if tag

        motion |
  sponsored by |
        Greens |
    (including |
          B90) |      Freq.     Percent        Cum.
---------------+-----------------------------------
            no |      1,549       79.11       79.11
           yes |        409       20.89      100.00
---------------+-----------------------------------
         Total |      1,958      100.00

. tab sponsor_leftpds if tag

        motion |
  sponsored by |
    Left Party |
   (previously |
          PDS) |      Freq.     Percent        Cum.
---------------+-----------------------------------
            no |      1,836       93.77       93.77
           yes |        122        6.23      100.00
---------------+-----------------------------------
         Total |      1,958      100.00

. 
. // create threefold variable sponsor
. gen sponsor_threefold=.
(1,971 missing values generated)

.         replace sponsor_threefold=1 if sponsor_govall==1|sponsor_govone==1
(667 real changes made)

.         replace sponsor_threefold=3 if sponsor_mps==1
(88 real changes made)

.         replace sponsor_threefold=2 if sponsor_threefold==.
(1,240 real changes made)

. label define sponsor_threefold 1 "Government" 2 "Opposition" ///
>         3 "Cross-partisan group of MPs"

. label values sponsor_threefold sponsor_threefold

. 
. tab sponsor_threefold if tag

          sponsor_threefold |      Freq.     Percent        Cum.
----------------------------+-----------------------------------
                 Government |        643       32.84       32.84
                 Opposition |      1,235       63.07       95.91
Cross-partisan group of MPs |         80        4.09      100.00
----------------------------+-----------------------------------
                      Total |      1,958      100.00

. 
. 
. * relationship sponsor - requestor (mentioned in text)
. *******************************************************
. // create threefold variable
. gen sponsor_is_requestor=.
(1,971 missing values generated)

.         replace sponsor_is_requestor=1 if ///
>                 (sponsor_kpd==1 & request_kpd==1) ///
>                 | (sponsor_leftpds==1 & request_leftpds==1) ///
>                 | (sponsor_greens==1 & request_greens==1) ///
>                 | (sponsor_spd==1 & request_spd==1) ///
>                 | (sponsor_fdp==1 & request_fdp==1) ///
>                 | (sponsor_cducsu==1 & request_cducsu==1) ///
>                 | (sponsor_gbbhe==1 & request_gbbhe==1) ///
>                 | (sponsor_dafvp==1 & request_dafvp==1) ///
>                 | (sponsor_dp==1 & request_dp==1) ///
>                 | (sponsor_fu==1 & request_fu==1) ///
>                 | (sponsor_spd==1 & request_spd==1)
(995 real changes made)

.         replace sponsor_is_requestor=0 if sponsor_is_requestor==.
(976 real changes made)

.         replace sponsor_is_requestor=99 if ///
>                 request_unknown==1
(616 real changes made)

.         label define sponsor_is_requestor 1 "yes" 0 "no" 99 "requestor unknown" 

.         label values sponsor_is_requestor sponsor_is_requestor 

. 
. tab sponsor_is_requestor if tag & sponsor_is_requestor!=99

sponsor_is_reques |
              tor |      Freq.     Percent        Cum.
------------------+-----------------------------------
               no |        356       26.35       26.35
              yes |        995       73.65      100.00
------------------+-----------------------------------
            Total |      1,351      100.00

. 
. 
. 
. ********************************************************************************
. ********************************************************************************
. * 2. MP CHARACTERISTICS
. ********************************************************************************
. ********************************************************************************
. 
. use mp_characteristics_BJPS, clear
(German Roll Call Data 1949-2013 | Type 'notes' for more information.)

. 
. egen tag_mp = tag(mp_id)

. 
. * number of observations (mentioned in Figure 1)
. ************************************************
. count
  11,238

. 
. * number of mandates (mentioned in Figure 1)
. ********************************************
. // create tag variable for one observation per MP and legislative period
. egen tag_mp_elecper=tag(mp_id elecper)

. count if tag_mp_elecper==1  // => 10299
  10,229

. 
. * number of unique MPs (mentioned in text and Figure 1)
. ********************************************************
. count if tag_mp==1
  3,588

. 
. 
. ********************************************************************************
. ********************************************************************************
. * 3. VOTING BEHAVIOR
. ********************************************************************************
. ********************************************************************************
. 
. use voting_behavior_BJPS, clear
(German Roll Call Data 1949-2013 | Type 'notes' for more information.)

. merge m:1 vote_id using vote_characteristics_BJPS, keepusing(vote_id2 free_vote)

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                         1,127,393  (_merge==3)
    -----------------------------------------

. 
. * number of observations / voting decisions (mentioned in text and Figure 1)
. ****************************************************************************
. count // => number of observations in dataset
  1,127,393

. 
. // ID for individual voting decisions
. egen tag = tag(mp_id vote_id2)

. count if tag
  1,119,622

. 
. 
. * deviating behavior (Figure 5)
. *******************************
. // generate variable on government status
. gen govstatus=.
(1,127,393 missing values generated)

.         replace govstatus=1 if ///
>                 (ppg==2&(elecper==1|elecper==2|elecper==3|elecper==4|elecper==5 ///
>                         |elecper==10|elecper==11|elecper==12|elecper==13|elecper==16|elecper==17)) ///
>                 | (ppg==1&(elecper==6|elecper==7|elecper==8 ///
>                         |elecper==14|elecper==15|elecper==16)) ///
>                 |(ppg==4&(elecper==1|elecper==4|elecper==6 ///
>                         |elecper==7|elecper==8|elecper==9|elecper==10|elecper==11|elecper==12 ///
>                         |elecper==13|elecper==17)) ///
>                 | (ppg==5 & (elecper==14|elecper==15))
(615,052 real changes made)

.         replace govstatus=2 if ///
>                 (ppg==2&(elecper==6|elecper==7|elecper==8|elecper==14|elecper==15)) ///
>                 | (ppg==1&(elecper==1|elecper==2|elecper==3|elecper==4|elecper==10 ///
>                         |elecper==11|elecper==12|elecper==13|elecper==17)) ///
>                 | (ppg==4&(elecper==3|elecper==14|elecper==15|elecper==16)) ///
>                 | (ppg==5 & (elecper==9|elecper==10|elecper==11|elecper==12 ///
>                         |elecper==13|elecper==16|elecper==17)) ///
>                 | (ppg==6)
(469,955 real changes made)

.         replace govstatus=3 if ///
>                 (ppg==2&elecper==9) ///
>                 | (ppg==1&(elecper==5|elecper==9)) ///
>                 | (ppg==4&(elecper==2|elecper==5)) ///
>                 | (ppg==11)
(42,386 real changes made)

.         label define govstatus 1 "Government" 2 "Opposition" 3 "Mixed"

.         label values govstatus govstatus

. 
. // label legislative period to include time spans
. label define elecper2 1 "1949-53" 2 "1953-57" 3 "1957-61" ///
>         4 "1961-65" 5 "1965-69" 6 "1969-72" 7 "1972-76" ///
>         8 "1976-80" 9 "1980-83" 10 "1983-87" ///
>         11 "1987-91" 12 "1991-94" 13 "1994-98" ///
>         14 "1998-02" 15 "2002-05" 16 "2005-09" ///
>         17 "2009-13"

. label values elecper elecper2

. 
. // graph
. count if (vote_dev==1|vote_dev==2|vote_dev==3) & free_vote!=1
  925,721

. 
. tabplot vote_dev elecper if (vote_dev==1|vote_dev==2|vote_dev==3) ///
>         & free_vote!=1, by(ppg, graphregion(margin(small)) col(2) ///
>         note(" " "Numbers: percentage in this category (in this legislative period)" ///
>         "Color of bars: government status during this legislative period (government=black, opposition=white, both
> =grey)" /// ///
>         " " "Unit of observation: behavior of individual MP on single RCV (n=925,721)." ///
>         "Free votes, absences, and votes without identifiable party line excluded.", span)) ///
>         xtitle("") percent(elecper ppg) ///
>         showval(offset(.35) format(%9.0f) mlabsize(*0.9)) ///
>         separate(govstatus) bar1(bcol(black)) bar2(bcol(gs14) bfcol(none)) bar3(bcol(gs12)) ///
>         xsize(6) xlab(, angle(90) labsize(medsmall)) ///
>         ylab(1 "weak" 2 "strong" 3 "none") ytitle("Deviation from the party line") ///
>         graphregion(margin(zero)) scheme(s1mono) 

. graph export Figure5.emf, replace
(file C:\Users\ba1hy3\Documents\Projekte\NA_EzA\RNote_2017\BJPS\final\Figure5.emf written in Enhanced Metafile forma
> t)

.         
. 
. log close
      name:  <unnamed>
       log:  C:\Users\ba1hy3\Documents\Projekte\NA_EzA\RNote_2017\BJPS\final\Sieberer_etal_BJPS2018_10_Jul_2018.log
  log type:  text
 closed on:  10 Jul 2018, 17:32:57
--------------------------------------------------------------------------------------------------------------------
